package model

import (
	"gorm.io/gorm"
	"time"
)

// 购物车
type ShoppingCart struct {
	gorm.Model
	UserId  int32 `gorm:"column:user_id;type:int(11);index;not null;comment:用户Id"`
	GoodsId int32 `gorm:"column:goods_id;type:int(11);index;not null;comment:商品Id"`
	Nums    int32 `gorm:"column:nums;type:int(11);not null;comment:商品数量"`
	Checked bool
}

// 订单信息表
type OrderInfo struct {
	gorm.Model
	UserId       int32   `gorm:"column:user_id;type:int(11);index;not null;comment:用户Id"`
	OrderSn      string  `gorm:"column:order_sn;type:varchar(50);index;not null;comment:订单号"`
	PayType      int8    `gorm:"column:pay_type;type:tinyint(1);not null;comment:1支付宝，2微信"`
	Status       int8    `gorm:"column:status;type:tinyint(1);not null;comment:1待支付，2成功，3超时关闭，4交易创建，5交易结束"`
	TradeNo      string  `gorm:"column:trade_no;type:varchar(255);not null;comment:交易号"`
	OrderMount   float32 `gorm:"column:order_mount;type:decimal(10,2);not null;comment:订单金额"`
	PayTime      time.Time
	Address      string `gorm:"column:address;type:varchar(255);not null;comment:地址"`
	SignerName   string `gorm:"column:signer_name;type:varchar(20);comment:收货人名称"`
	SingerMobile string `gorm:"column:singer_mobile;type:char(11);comment:收货人电话"`
	Post         string `gorm:"column:post;type:varchar(20);comment:订单备注"`
}

// 订单商品
type OrderGoods struct {
	gorm.Model
	OrderId    int32   `gorm:"column:order_id;type:int(11);index;not null;comment:订单Id"`
	GoodsId    int32   `gorm:"column:goods_id;type:int(11);index;not null;comment:商品Id"`
	GoodsName  string  `gorm:"column:goods_name;type:varchar(100);comment:商品名称"` //商品快照
	GoodsImage string  `gorm:"column:goods_image;type:varchar(200);comment:商品图片"`
	GoodsPrice float32 `gorm:"column:goods_price;type:decimal(10,2);comment:当时的订单金额"`
	Nums       int32   `gorm:"column:nums;type:int(11);comment:商品数量'"`
}
